﻿// Decompiled with JetBrains decompiler
// Type: LayersParser.Objects.CustomizedPathConfiguration
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System.Xml.Linq;
using Tecnomatix.Engineering;


namespace LayersParser.Objects;

public class CustomizedPathConfiguration : Common
{
  private TxOLPUtilities olpUtilities = new TxOLPUtilities();
  private string _customizedPath;
  private string _controller;
  private string _version;

  public CustomizedPathConfiguration(
    string customizedPath,
    string name,
    string controller,
    string modulePath)
  {
    this._customizedPath = customizedPath;
    this._controller = controller;
    this.Name = name;
    this.Node = new XElement((XName) "Version", new object[3]
    {
      (object) new XAttribute((XName) "Name", (object) name),
      (object) new XAttribute((XName) nameof (CustomizedPath), (object) customizedPath),
      (object) new XElement((XName) "ModuleName", (object) modulePath)
    });
  }

  public CustomizedPathConfiguration(string customizedPath, string version, string controller)
  {
    this._controller = controller;
    this._customizedPath = customizedPath == null ? $"{this.olpUtilities.GetOLPInstallationDirectory()}/{controller}" : customizedPath;
    this.Name = version;
  }

  public CustomizedPathConfiguration(XElement xElement, string controller)
  {
    this._controller = controller;
    this.Node = xElement;
    this.Name = this.Node?.Attribute((XName) "Name").Value;
    if (this.Node.Attribute((XName) nameof (CustomizedPath)) != null)
      this._customizedPath = this.Node.Attribute((XName) nameof (CustomizedPath)).Value;
    else
      this._customizedPath = $"{this.olpUtilities.GetOLPInstallationDirectory()}/{controller}";
  }

  public string Controller
  {
    get => this._controller;
    set => this._controller = value;
  }

  public string CustomizedPath
  {
    get => this._customizedPath;
    set => this._customizedPath = value;
  }
}
